#include <bits/stdc++.h>
using namespace std;
using PP = pair<int, int>;
deque<PP> Q;
// deque< pair<int ,int >> Q;
int main() {
  int query;
  cin >> query;
  while (query--) {
    int op;
    cin >> op;
    if (op == 1) {
      int c, x;
      cin >> c >> x;
      Q.push_back({c, x});
    } else {
      int k;
      cin >> k;
      int cnt = 0;
      long long sum = 0;
      while (!Q.empty()) {
        int c, x;
        tie(c, x) = Q.front();
        // int c = Q.front().first;
        // int x = Q.front().second;
        Q.pop_front();
        
        if (c + cnt > k) {
          sum += 1ll * (k - cnt) * x;
          Q.push_front({c + cnt - k, x});
          break;
        } else {
          sum += 1ll * c * x;
          cnt += c;
        }
      }
      cout << sum << endl;
    }
  }
  return 0;
}
